import java.util.Random;

public class MathQuiz {
    public static void main(String[] args) {
        int numberOfQuestions = 50;
        generateMathQuiz(numberOfQuestions);
    }

    public static void generateMathQuiz(int count) {
        Random random = new Random();

        for (int i = 1; i <= count; i++) {
            int num1 = random.nextInt(101);  // 生成 0 到 100 的随机数
            int num2 = random.nextInt(101);  // 生成 0 到 100 的随机数
            char operator = random.nextBoolean() ? '+' : '-';  // 随机选择加或减

            // 确保减法不会得到负数
            if (operator == '-' && num1 < num2) {
                int temp = num1;
                num1 = num2;
                num2 = temp;
            }

            System.out.println("题目 " + i + ": " + num1 + " " + operator + " " + num2 + " = ");
        }
    }
}

